<template>
  <div class="float-note__warp a-link" @click="link">
    <div class="note-left">文章</div>
    <div class="note-right">
      <div class="title ellipsis-1">{{ value.title }}</div>
      <div class="content ellipsis-1">{{ content }}</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: Object,
      default: {},
    },
  },
  computed: {
    content() {
      let str = "";
      str = this.value.content.replace(/<(?!img).*?>/g, "");
      return str;
    },
  },
  methods: {
    link() {
      this.$router.push({
        path: `/note/details/${this.value.noteId}`,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.float-note__warp {
  display: flex;
  margin-bottom: 15px;
  width: 100%;
  .note-left {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 5px;
    background-color: #bbb;
    color: #ffffff;
    font-size: 12px;
    text-align: center;
    line-height: 50px;
    margin-right: 10px;
  }
  .note-right {
    flex: 1;
  }
  .title {
    font-size: 16px;
    font-weight: bold;
  }
  .content {
    font-size: 12px;
    color: #999;
  }
}
</style>